package com.ruoyi.hqfinance.service.impl;

import com.github.pagehelper.PageHelper;
import com.ruoyi.hqfinance.domain.HqTransferDifferenceWeightSheet;
import com.ruoyi.hqfinance.domain.vo.HqTransferDifferenceWeightSheetVo;
import com.ruoyi.hqfinance.mapper.HqTransferDifferenceWeightSheetMapper;
import com.ruoyi.hqfinance.service.HqTransferDifferenceWeightSheetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HqTransferDifferenceWeightSheetServiceImpl implements HqTransferDifferenceWeightSheetService {
    @Autowired
    private HqTransferDifferenceWeightSheetMapper hqTransferDifferenceWeightSheetMapper;

    @Override
    public List<HqTransferDifferenceWeightSheet> collect(HqTransferDifferenceWeightSheetVo vo) {
        PageHelper.startPage(vo.getPageDate());
        List<HqTransferDifferenceWeightSheet> sheets = hqTransferDifferenceWeightSheetMapper.collect(vo);
        assert sheets != null;
        for (HqTransferDifferenceWeightSheet hqTransferDifferenceWeightSheet : sheets){
            if (vo.getDateType() == 2){
                hqTransferDifferenceWeightSheet.setSettleDate(vo.getStartTime() + "至" + vo.getEndTime());
            }
        }
        return sheets;
    }
}
